    #include<stdio.h>  
    #include<sys/stat.h>  
    #include<dirent.h>  
    #include<stdlib.h>  
    #include<string.h>  
    #include<sys/types.h>  
    void printpath();  
    char *inode_to_name(int);  
    int getinode(char *);  
    int main()  
    {  
        printpath();  
        putchar('\n');  
        return ;  
    }  
    void printpath()  
    {  
        int inode,up_inode;  
        char *str;  

        inode = getinode(".");  
        up_inode = getinode("..");  
        chdir("..");  
        str = inode_to_name(inode);  
        if(inode == up_inode) {    
            return;  
        }  
        printpath();  
        printf("/%s",str);  
    }  
    int getinode(char *str)  
    {  
        struct stat st;  
        if(stat(str,&st) == -1){  
            perror(str);  
            exit(-1);  
        }  
        return st.st_ino;  
    }  
    char *inode_to_name(int inode)  
    {  
        char *str;  
        DIR *dirp;  
        struct dirent *dirt;  
        if((dirp = opendir(".")) == NULL){  
            perror(".");  
            exit(-1);  
        }  
        while((dirt = readdir(dirp)) != NULL)  
        {  
            if(dirt->d_ino == inode){  
                str = (char *)malloc(strlen(dirt->d_name)*sizeof(char));  
                strcpy(str,dirt->d_name);  
                return str;  
            }  
        }  
        perror(".");  
        exit(-1);  
    }  
